package edu.jmu.transmissionassistant.adapter

import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import edu.jmu.transmissionassistant.databinding.ReViewItemBinding
import edu.jmu.transmissionassistant.model.UploadFileInfo


class RvAdapter(private val dataSet:ArrayList<UploadFileInfo>):RecyclerView.Adapter<RvAdapter.ViewHolder>() {
     class ViewHolder(val binding:ReViewItemBinding) : RecyclerView.ViewHolder(binding.root)

    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {

        val binding=ReViewItemBinding.inflate(LayoutInflater.from(parent.context),parent,false)
        return ViewHolder(binding)

    }

    override fun onBindViewHolder(holder: ViewHolder, position: Int) {

        holder.binding.filenameTv.text= dataSet[position].filename
        holder.binding.uploadDateTv.text=dataSet[position].uploadDate.toString()
    }

    override fun getItemCount(): Int {

        return dataSet.size
    }

}